<?php
class Application_Model_PayHistoryMapper extends Application_Model_Mapper
{
  protected $_dbTableClass = "Application_Model_DbTable_PayHistory";
  protected $_model = "Application_Model_PayHistory";

  public function save(Application_Model_Base $obj)
  {
    $pk = $obj->getPrimaryKey();
    $options = $obj->getOptions();
    unset($options['time']);
    if (!($id = $obj->get($pk))) {
      return $this->getDbTable()->insert($options);
    } 
    else {
      $data = $options;
      unset($data[$pk]);
      return $this->getDbTable()->update($data, "$pk = $id");
    }
  }
}


